package org.finesys.system.controller;

import lombok.RequiredArgsConstructor;
import org.finesys.common.core.module.R;
import org.finesys.system.api.dto.ThirdBindDto;
import org.finesys.system.constants.ControllerRestApiConfig;
import org.finesys.system.service.SysThirdService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping(ControllerRestApiConfig.THIRD)
public class SysThirdController {

    private final SysThirdService sysThirdService;

    /**
     * 获取第三方平台的绑定信息
     *
     * @return 第三方平台的绑定信息
     */
    @GetMapping("/bindInfo")
    public R<?> bindInfo() {
        return R.success(sysThirdService.bindInfo());
    }

    /**
     * 解除绑定
     *
     * @param thirdBindDto 平台类型
     */

    @PutMapping("/unbind")
    public R<Void> unbind(@RequestBody ThirdBindDto thirdBindDto) {
        sysThirdService.unbind(thirdBindDto.getType());
        return R.success();
    }
}
